<?php
/**
 * User: jc234316
 * Date: 25/05/2014
 * Time: 1:44PM
 */

require 'init.php';

if (empty($_POST) === false) {
    $email = trim($_POST['email']);
    $confirmEmail = trim($_POST['confirmEmail']);
    $name = trim($_POST['name']);

    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $message[] = $email . ' is not a valid e-mail address.';
    } else
        if (empty($email) === true || empty($confirmEmail) === true || empty($name) === true) {
            $message[] = 'All fields marked with an asterisk (*) are required.';
        } else
            if ($email !== $confirmEmail) {
                $message[] = 'Email addresses do not match.';
            } else {
                $message[] = 'Your form has been submitted successfully!';
            }
}
?>

<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <link href="css/main.css" rel="stylesheet" type="text/css">
    <script src="javascripts/validateForm.js"></script>
    <title>Contact Us</title>
</head>
<body>
<div id="container">
    <div id="leftCogSplash"><img src="images/cogLeft.png"/></div>
    <div id="rightCogSplash"><img src="images/cogRight.png"/></div>
    <?php include "navbar.php"; ?>
    <div id="content">
        <div id="contentFrame">
            <form id="contactForm" name="contactForm" action="contactus.php" method="post"
                  enctype="text/plain">
                <div id="contactInfo">
                    <h2 style="text-align: center">Contact Us</h2>

                    <p style="text-align: center">
                        Your feedback helps us serve you better!
                    </p>

                    <h3 style="text-align: center">Our contact details</h3>
                    <p>
                        <span class="contactLeft">Phone:</span>
                        <span class="contactRight"><a href="tel:+61747741234">07 4774 1234</a></span><br />
                    </p>
                    <p>
                        <span class="contactLeft">Fax:</span>
                        <span class="contactRight">07-4774 4321</span><br />
                    </p>
                    <p>
                        <span class="contactLeft">Address:</span><br /><br />
                        <span class="contactRight">
                                Steamy Tees<br/>
                                Steampunk Emporium<br/>
                                Level 7 22 Steamy St<br/>
                                Cairns QLD 5465<br/></a></span>
                    </p>
                    <p>
                        <span class="contactLeft">Email:</span>
                        <span class="contactRight">feedback@steamytees.com</span><br /><br />
                    </p>

                    <p style="text-align: center">

                        We love to hear from the people who use our products and services every day.
                        Please use this Contact Us form if you have a complaint, enquiry or feedback/suggestion. We will
                        do
                        our best to respond to your email as soon as possible.
                    </p>
                </div>
                <br/>
                <label for="name">Full name*:</label>
                <input type="text" name="name" id="name" size="35"
                       value="<?php if (isset($_POST['name'])) echo htmlentities($_POST['name']); ?>"
                <br/>
                <br/>
                <label for="email">Email*:</label>
                <input type="text" name="email" id="email" size="35"
                       value="<?php if (isset($_POST['email'])) echo htmlentities($_POST['email']); ?>"
                <br/>
                <br/>
                <label for="confirmEmail">Confirm Email*:</label>
                <input type="text" name="confirmEmail" id="confirmEmail" size="35"
                       value="<?php if (isset($_POST['confirmEmail'])) echo htmlentities($_POST['confirmEmail']); ?>"
                <br/>
                <br/>
                <label for="feedbackArea" id="feedbackLabel">Enquiry* (Max 2000 characters):</label>
                <textarea cols="40" rows="6" name="feedbackArea" id="feedbackArea"
                          maxlength="2000"></textarea>
                <br/>

                <div id="submission">
                    <input type="submit" value="Submit" id="submit"/>
                </div>
                <div id="statusBar">
                    <?php
                    if (empty($message) === false) {
                        echo "<script type='text/javascript'>document.getElementById('statusBar').style.display = 'block';</script>";
                        echo '<p>' . implode('<p></p>', $message) . '</p>';
                    }
                    ?>
                </div>
            </form>
        </div>
    </div>
    <?php require 'footer.php' ?>
</div>
</body>
</html>
